import { IsNotEmpty, IsString, Length } from "class-validator";
import { BaseEntity } from "../BaseEntity";

export default class AdminEntity extends BaseEntity {
  @Length(2, 10, { message: "名字长度必须在2-10歌字符" })
  @IsNotEmpty({ message: "名字不能为空" })
  @IsString({ message: "name必须是字符串" })
  public name: string;

  @Length(3, 10, { message: "登录账号必须3-10个字符" })
  @IsNotEmpty({ message: "登录账号不能为空" })
  @IsString({ message: "loginId必须是字符串" })
  public loginId: string;

  @Length(4, 16, { message: "登录密码必须4-16歌字符" })
  @IsNotEmpty({ message: "登录密码不能为空" })
  @IsString({ message: "loginPwd必须是字符串" })
  public loginPwd: string;

  public static transform(plainObject: object): AdminEntity {
    return super.baseTransform(AdminEntity, plainObject);
  }
}
